home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Reptile / Reptile 6.0.sit / Reptile 6.0.rsrc / TEXT_141.txt < prev    next >
Text File  |  1997-08-18  |  10KB  |  219 lines

  1. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2.                                                           Hacking HyperCard Stax FAQ
  3.                                                                         By mephistopheles ... satan@cafemagnolia.com
  4.          The few days it took to write this fiel had been some time after using                 
  5.          hypercard so the scripting might be a little rough.
  6. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7.  
  8. Hacking HyperCard is really rather simple if you have a high command of the HyperTalk language.  The truth is, _any_ stack written in HyperCard 2.3.5 or earlier can be hacked.  I am writing this text for HC novices because the HyperCard Gurus out there could do all this blindfolded and with their hands tied behind their backs.
  9.  
  10. The Tools you will need:
  11.         HyperCard 2.2 or later (is there? whatever happened to HC3?)
  12.         ResEdit or other resource editor
  13.         
  14. -----------------------------
  15. Why hack HyperCard Stacks?
  16.         Maybe there is some code or graphix you want to 'borrow' or maybe you just              
  17.         want to be able to modify it enough to call it your own.  Or you just do it 
  18.         for the kick of it.
  19. -----------------------------
  20. What are the basic HC Hacking techniques?
  21.         Well, usually the first thing you need to do is get the scripts of stack X (your target)
  22.  
  23. a sample script that you would put in a button in another stack would be:
  24.  
  25. on mouseUp
  26.         lock errormessages
  27.         lock screen
  28.         push card
  29.         go cd 1 of stack X
  30.         get the script of stack X
  31.         put it into stackXscript
  32.         pop card
  33.         put stackXscript into cd fld "stack script"
  34.         push card
  35.         go cd 1 of stack X
  36.         get the script of this card
  37.         put it into cardXscript
  38.         pop card
  39.         put cardXscript into cd fld "stack script"
  40.         unlock screen
  41.         unlock errormessages
  42. end mouseup
  43.  
  44. You get the idea.  Basically, you go to the other stack, get the scripts and then put them into a field in your stack.
  45. Then you want to look for things like this:
  46.  
  47. on openStack
  48.         set userlevel to 1 --or anything less than 5
  49.         set userlevel(1)
  50.         set cantmodify of this stack to true
  51.         set cantabort of this stack to true
  52.         pass openStack
  53. end openStack
  54.         
  55. Once you find where the stack is locked check if the openstack executes anything before the locking lines. such as
  56.  
  57. on openStack
  58.         global lastUser
  59.         ask "Please log in" with lastUser
  60.         if it = "bob" then
  61.                 ask password clear "Password?" with ""
  62.                 put it into cd fld "logged in"
  63.         end if
  64.         
  65.         set userlevel to 1 --or anything less than 5
  66.         set cantmodify of this stack to true
  67.         set cantabort of this stack to true
  68.         pass openStack
  69. end openStack
  70.  
  71. So, before the locking code it will bring up a dialog box that asks for a username and then, if you type "bob" it will ask for a password.  Then, what ever you type in that field will be logged into a field.
  72. What do you do to bypass security? as soon as the dialog box pops up, press command-. to stop the script and the stack is yours for the taking.
  73.  
  74. I used that technique to hack into the popular hypercard game "Immortal Combat" Before the stack was locked it brought up a dialog that said "Did you read the read-me?" with "OK."  I hid command-. and stole all of the graphics and used them to create my own IC hack: Mirror Match.
  75.  
  76.         There are only 2 times stopping the script before the locking code won't work 
  77. 1) When "set cantabort to true" is set very early in the script, before you have a chance to hit command-.
  78. 2) When the author of the stack uses HyperCards built in security (the "protect         
  79.         stack" menu item under the File menu) is used.
  80.         
  81.  
  82. Another thing you might see is something like this
  83.  
  84. --*/ Security /*--
  85.   if the optionkey is down then
  86.     ask password clear "Enter the password:" with ""
  87.     if it is "Secretpassword" then --change for yr stack
  88.       --enter w/o lock--
  89.     else
  90.       systemslock
  91.     end if
  92.   else if the optionkey is not down then
  93.     systemslock
  94.   end if
  95. --*/ End Security /*--
  96.  
  97. This is a back door.  It is something only the programmer (or the cracker) knows about that would easily bypass all security.
  98.  
  99. Another script that is EXTREMELY useful is the auxilary input: script.
  100. Insert this in your Home stack script:
  101.  
  102. on commandKeyDown x
  103. √ä √äif the shiftKey is down then
  104. √ä √ä√ä √ä √äif x=u then
  105. √ä √ä√ä √ä √ä √ä √ä ask "auxiliary input:"
  106. √ä √ä√ä √ä √ä √ä√ä√ä do it
  107. √ä√ä √ä√ä√ä√ä√äend if
  108. √ä√ä √ä √äend if
  109. √ä √äpass commandKeyDown
  110. end commandKeyDown
  111. on god
  112.         set userlevel to 5
  113.         set cantabort of this stack to false
  114.         set cantmodify of this stack to false
  115.         show msg
  116. end god
  117.  
  118. obviously, this script brings up an ask dialog box when you type command-shift-u. √äType what you want to execute and press OK.Some commands you would want to throw at it are:
  119.  
  120. set userlevel to 5 --god mode
  121. set cantabort to false --means you can press command-. to stop scripts
  122. set cantmodify to false --means you can modify the stack
  123.  
  124. or you could just type god (god script above)
  125.         
  126.         The only times the auxiliary input wont work is when they have the following script in their stack:
  127.  
  128. on commandkeydown x
  129.         --do nothing
  130.         --this blocks all commandkeydown messages from reaching the home staq.
  131. end commandkeydown
  132.  
  133. or if they have HC's built-in security enabled.
  134.  
  135. -----------------------------
  136. How do I bypass HyperCard's built-in security?
  137.  
  138.         First look under the file menu.  If you don't see a menu item "Protect stack" then let go, hold down the command key and look under File again.  Then select "Protect Stack" and you will see one of two things.
  139.  
  140. 1) an ask dialog box asking for a password
  141. 2) the protect stack dialog box.  That means the staqs author was stupid enough not to set a password.  Yahoo!
  142.  
  143. If you see the protect stack dialog box uncheck all of the check boxes and set the user level to Scripting.  That stack is cracked!
  144.  
  145. If you are asked for a password, you may as well hit cancel unless you think you know the password.  
  146. Then, run the following script.  WARNING: DONT RUN THE FOLLOWING SCRIPT ON A STACK THE IS SET TO PRIVATE ACCESS!  IT COULD DAMAGE THE STACK.  But if you can get into a stack without having to type in a password, you can try it.
  147.  
  148.  
  149. on mouseUp
  150.   put the long name of this stack into stackname
  151.   answer "CAUTION: This script could damage the stack.  Make sure you have a copy." with "Cancel" or "Continue"
  152.   if it is "Cancel" then exit mouseUp
  153.   answer file "Select the stack to deprotect:" of type stack
  154.   if it is empty then exit mouseUp
  155.   put it into longStack
  156.   set cursor to busy
  157.   set the itemDelimiter to colon
  158.   put last item of longStack into stackName
  159.   set the itemDelimiter to comma
  160.   set lockMessages to true
  161.   deprotect longStack
  162.   if the result is empty then
  163.     set cursor to busy
  164.     lock screen
  165.     go stack stackName
  166.     set cantModify of this stack to false
  167.     set cantDelete of this stack to false
  168.     set cantPeek of this stack to false
  169.     set cantAbort of this stack to false
  170.     get the userLevel
  171.     set the userLevel to 5
  172.     go to card 3 of stackname
  173.     unlock screen
  174.     answer "Stack now deprotected!" with "OK"
  175.   else
  176.     if the result is -49 then
  177.       answer "That file is open by another application"
  178.     else
  179.       if the result is -44 then
  180.         answer "The disk is locked.  Please move to a unlocked volume and try again."
  181.       else
  182.         answer "Failed: unexpected file system error: " & the result with "OK"
  183.       end if
  184.     end if
  185.   end if
  186.   set lockMessages to false
  187. end mouseUp
  188.  
  189. notice it calls an xternal command called deprotect.  That XCMD is in this text file.  So open up this file with ResEdit, copy the XCMD resource and paste it into your home stack.  This script I...uh....borrowed from a stack called 'deprotect stack' that you should be able to find in the INFO-MAC archive.
  190.  
  191. There is also another XCMD&XFCN bundle in the fiel called "unprotect" and "filename." which you should use on a stack that does have "Private Access" enabled.  To use unprotect, copy the unprotect XCMD and filename XFCN and paste them into your home stack.  Then run the following script:
  192.  
  193. on mouseUp
  194.   put filename("STAK") into fname
  195.   if fname is empty then exit mouseUp
  196.   unprotect fname
  197.   if the result is empty
  198.   then answer "Deprotect Successful" with "OK"
  199.   else if the result is -49
  200.   then answer "Sorry, that file is busy."
  201.   else if the result is -44
  202.   then answer "Sorry, the disk is locked."
  203.   else answer "Failed: unexpected file system error: " & the result with "OK"
  204. end mouseUp
  205.  
  206. --------------------
  207. Are there any other Stack hacking techniques?
  208.  
  209. The one other method only works if there is an xcmd or xfcn in the stack.  (Note: this may not work due to scripting anomalities and/or different versions of hc)
  210.  
  211. 1.  Delete the XCMD or XFCN rsrc
  212. 2.  Open the stack and fiddle around with it.  *Sometimes* you will get an error about that XCMD or XFCN and the stack will pop open by itself.
  213.  
  214. I only read about this in comp.sys.mac.hypercard a while back and have never tried it.
  215.  
  216. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  217. Have fun...
  218. Some of these external rsrcs and scripts are from Flux's Devils Workshop (which is a great hc hacking stack) and Deprotect.
  219. Sorry if i offended anyone but√â uh√â thats life.